/**
 * 
 */
package com.music.service.playlists.constants;

/**
 * @author asanthan
 * 
 */
public class PlaylistSQLQueries {
	public static final String INSERT_PLAYLIST =
		"insert into playlists(created_member_id,playlist_name,state,creation_date) values " +
		"(?,?,?,sysdate)";
	
	public static final String VIEW_PLAYLISTS = 
		"select playlist_id,playlist_name,created_member_id,creation_date,last_added_song_id," +
		"last_update_date,last_accessed_date,repeat_all,shuffle,state from playlists where created_member_id=? && state != ? order by last_update_date";
	
	public static final String VIEW_RECENT_PLAYLISTS = 
		"select playlist_id,playlist_name,created_member_id,creation_date,last_added_song_id," +
		"last_update_date,last_accessed_date,repeat_all,shuffle,state from playlists where created_member_id=? && state != ? order by last_update_date limit ?";
	
	/**
	 * Check whether member has permission on playlist.
	 */
	public static final String GET_PLAYLIST_INFO_FOR_MEMBER = 
		"select playlist_id,playlist_name,created_member_id,creation_date,last_added_song_id," +
		"last_update_date,last_accessed_date,repeat_all,shuffle,state from playlists where created_member_id=? && playlist_id = ?" +
		" && state != ? ";
	
	public static final String ADD_SONG_TO_PLAYLIST = 
		"insert into playlist_songs_r(playlist_id,song_id,song_position)" +
			"values (?,?,?)";
	
	public static final String DELETE_SONG_FROM_PLAYLIST =
		"delete from playlist_songs_r where playlist_id = ? && song_id = ?";
	
	public static final String DELETE_PLAYLIST =
		"update playlists set state = ? where playlist_id =? && created_member_id=?";
}
